<template>
  <div class="kill-box">
    <div class="time-box">
      <span class="top">嗨购秒杀</span>
      <span class="red">&nbsp;&nbsp;8点场&nbsp;&nbsp;</span>
      <van-count-down :time="time">
        <template #default="timeData">
          <span class="block">{{ timeData.hours }}</span>
          <span class="colon">:</span>
          <span class="block">{{ timeData.minutes }}</span>
          <span class="colon">:</span>
          <span class="block">{{ timeData.seconds }}</span>
        </template>
      </van-count-down>
      <span class="hot">爆款轮番炒→</span>
    </div>
    <br />
    <div class="bottom-box">
      <ul>
        <li
          v-for="obj in goodlist"
          :key="obj.proid"
          @click="godetail(obj.proid)"
        >
          <img :src="obj.img1" />
          <p class="price">￥{{ obj.originprice }}</p>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { getKill } from "@/api/home";
export default {
  data() {
    return {
      goodlist: [],
      time: 3600000,
    };
  },
  methods: {
    godetail(proid) {
      this.$router.push("/Detail/" + proid);
    },
  },
  created() {
    getKill({ limitNum: 12 }).then((res) => {
      let data = res.data;
      console.log(data);
      if (data.code == 200) {
        this.goodlist = data.data;
        console.log("秒杀", this.goodlist);
      }
    });
  },
};
</script>

<style scoped>
.time-box {
  width: 100%;
  /* height: ; */
  background-color: white;
  /* margin-top: 1.25rem; */
  padding-top: 10px;
  display: flex;
}
.hot {
  color: red;
  font-size: 0.75rem;
  margin-left: 5rem;
}
.kill-box {
  width: 100%;
  height: 10rem;
  background-color: white;
  margin-top: 0.375rem;
  border-radius: 0.625rem;
}
.red {
  font-size: 0.875rem;
  color: red;
}

.bottom-box {
  /* border: 1px solid black; */
  /* margin-top: .25rem; */
  margin-top: 0.25rem;
  width: 100%;
  height: 6.875rem;
}
.bottom-box img {
  width: 4.375rem;
  height: 3.75rem;
}
.bottom-box ul {
  display: flex;
  flex-wrap: nowrap;
  overflow: auto;
  scrollbar-width: none;
}
.bottom-box ul li {
  margin-left: 0.25rem;
}
.bottom-box .price {
  color: red;
  font-size: 0.75rem;
}

.colon {
  display: inline-block;
  margin: 0 4px;
  color: #ee0a24;
}
.block {
  display: inline-block;
  width: 22px;
  color: #fff;
  font-size: 12px;
  text-align: center;
  background-color: #ee0a24;
  border-radius: 0.375rem;
}
</style>